#ifndef SIPINVB2BSESSION_HPP__
#define SIPINVB2BSESSION_HPP__

#include "SipGDServiceConfigure.hpp"
#include "SipB2BSession.hpp"
#include "SipInviteSession.hpp"


namespace wtsip{

class WTGD_SIPSRV_PUBLIC CSipInvB2bSession: 
    public CSipB2BSession,
    public CSipRealPlayHandle
{
public:

    CSipInvB2bSession(CSipGDService& srv, CSipInviteSession& caller, CSipInviteSession& callee);

    virtual ~CSipInvB2bSession(void);

    virtual bool startCaller(SipMessage& calleeReq);

protected:

    bool insertMap(const resip::Data& callerId, const resip::Data& calleeId);

    const resip::Data& getCalleeId(const resip::Data& callerId);

    /////////////////////  Invite handle  ///////////////////

    virtual bool onCancel(SipMessage& msg, CSipInviteSession& invs);

    virtual bool onCanceled(SipMessage& msg, CSipInviteSession& invs);

    virtual bool onPtzControl(SipMessage& msg, CSipInviteSession& invs);

    virtual bool onConnected(SipMessage& msg, CSipInviteSession& invs);

    virtual bool onDisconnected(CSipInviteSession& invs);

    virtual bool onTerminated(SipMessage& msg, CSipInviteSession& invs);

    virtual bool onTerminate(SipMessage& msg, CSipInviteSession& invs);

    ////////////////////   Session handle //////////////////////

    virtual bool onSuccess(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onFailed(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onTrying(SipMessage& msg, CSipSessionBase& sb);

    virtual bool onDestroy(CSipSessionBase& sb);

private:

    std::map<resip::Data, resip::Data> m_transMap;
};


}//namespace

#endif


